package com.ruoyi.system.service.impl;
import com.ruoyi.system.entity.PreventionHiddenInventory;
import com.ruoyi.system.mapper.PreventionHiddenInventoryMapper;
import com.ruoyi.system.service.PreventionHiddenInventoryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * 隐患清单(PreventionHiddenInventory)表服务实现类
 */
@Service("preventionHiddenInventoryService")
public class PreventionHiddenInventoryServiceImpl implements PreventionHiddenInventoryService {
    @Resource
    private PreventionHiddenInventoryMapper preventionHiddenInventoryDao;

    /**
     * 通过ID查询单条数据
     * @return 实例对象
     */
    @Override
    public PreventionHiddenInventory queryById(Integer id) {
        return this.preventionHiddenInventoryDao.queryById(id);
    }

    /**
     * 分页查询
     * @return 查询结果
     */
    @Override
    public List<PreventionHiddenInventory> queryByPage(PreventionHiddenInventory preventionHiddenInventory) {
        return preventionHiddenInventoryDao.queryAllByLimit(preventionHiddenInventory);
    }

    /**
     * 新增数据
     * @param preventionHiddenInventory 实例对象
     * @return 实例对象
     */
    @Override
    public PreventionHiddenInventory insert(PreventionHiddenInventory preventionHiddenInventory) {
        this.preventionHiddenInventoryDao.insert(preventionHiddenInventory);
        return preventionHiddenInventory;
    }

    /**
     * 修改数据
     * @param preventionHiddenInventory 实例对象
     * @return 实例对象
     */
    @Override
    public PreventionHiddenInventory update(PreventionHiddenInventory preventionHiddenInventory) {
        this.preventionHiddenInventoryDao.update(preventionHiddenInventory);
        return this.queryById(preventionHiddenInventory.getId());
    }

    /**
     * 通过主键删除数据
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.preventionHiddenInventoryDao.deleteById(id) > 0;
    }
}
